From: Takao Fujiwara Date: Wed, 29 Oct 2025 12:34:22 +0000 (+0900) Subject: keyboard: Call ibusManager.setEngine() with actual layout X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~44^2~28 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=e0ab0a68b6ee495d72898db513b053eba78773d8;p=gnome-shell.git keyboard: Call ibusManager.setEngine() with actual layout Currently ibusManager.setEngine() is always called with 'xkb:us::eng' US layout name but the actual language layout is more useful for IBus. Closes: https://gitlab.gnome.org/GNOME/gnome-shell/-/issues/8490 Part-of: --- diff --git a/js/misc/ibusManager.js b/js/misc/ibusManager.js index 0bd282b80..a9178805f 100644 --- a/js/misc/ibusManager.js +++ b/js/misc/ibusManager.js @@ -27,6 +27,8 @@ const IBUS_SYSTEMD_SERVICE = 'org.freedesktop.IBus.session.GNOME.service'; const TYPING_BOOSTER_ENGINE = 'typing-booster'; +const FALLBACK_ENGINE_ID = 'xkb:us::eng'; + function _checkIBusVersion(requiredMajor, requiredMinor, requiredMicro) { if ((IBus.MAJOR_VERSION > requiredMajor) || (IBus.MAJOR_VERSION === requiredMajor && IBus.MINOR_VERSION > requiredMinor) || @@ -282,7 +284,16 @@ class IBusManager extends Signals.EventEmitter { this._MAX_INPUT_SOURCE_ACTIVATION_TIME, this._cancellable); } catch (e) { - logErrorUnlessCancelled(e); + if (!logErrorUnlessCancelled(e)) + return; + + try { + await this._ibus.set_global_engine_async(FALLBACK_ENGINE_ID, + this._MAX_INPUT_SOURCE_ACTIVATION_TIME, + this._cancellable); + } catch (e2) { + logErrorUnlessCancelled(e2); + } } } diff --git a/js/ui/status/keyboard.js b/js/ui/status/keyboard.js index 2f6773c8c..a4d85debd 100644 --- a/js/ui/status/keyboard.js +++ b/js/ui/status/keyboard.js @@ -510,17 +510,14 @@ export class InputSourceManager extends Signals.EventEmitter { KeyboardManager.holdKeyboard(); this._keyboardManager.apply(is.xkbId); - // All the "xkb:..." IBus engines simply "echo" back symbols, - // despite their naming implying differently, so we always set - // one in order for XIM applications to work given that we set - // XMODIFIERS=@im=ibus in the first place so that they can - // work without restarting when/if the user adds an IBus input - // source. let engine; - if (is.type === INPUT_SOURCE_TYPE_IBUS) + if (is.type === INPUT_SOURCE_TYPE_IBUS) { engine = is.id; - else - engine = 'xkb:us::eng'; + } else { + const [name, variant = ''] = is.id.split('+'); + const [lang = 'eng'] = this._xkbInfo.get_languages_for_layout(is.id); + engine = `xkb:${name}:${variant}:${lang}`; + } this._ibusManager.setEngine(engine).then(() => { if (holdKeyboard)